<?php

namespace apiend\modules\shop\controllers;

use Yii;
use apiend\components\Controller;

/**
 * 动态关键字检索
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class SearchController extends Controller {

    public $modelClass = 'apiend\modules\shop\models\ShopUnifiedSearch';

    /**
     * Declares the allowed HTTP verbs.
     * Please refer to [[VerbFilter::actions]] on how to declare the allowed verbs.
     * @return array the allowed HTTP verbs.
     */
    protected function verbs() {
        return [
            '*' => ['GET']
        ];
    }

    public function actionIndex() {
        /* @var $model \apiend\modules\shop\models\ShopUnifiedSearch */
        $model = new $this->modelClass;
        $model->load(Yii::$app->request->getQueryParams(), '');
        return $model->search();
    }

}
